package com.javafactroy.kunlong.bip.icp.message.dxp.base;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import lombok.Data;
import lombok.ToString;

@Data
@ToString
public class DxpMsgResp extends DxpMsg {
    public DxpMsgResp() {
        super.header.setMsgType((short)0x06);
    }

    public static DxpMsgResp buildMessage() {
        DxpMsgResp rsp = new DxpMsgResp();
        DxpHeader header = new DxpHeader();

        rsp.setHeader(header);
        DxpBody mb = new DxpBody();
        mb.setBody("resp2leijmdas".getBytes());
        rsp.setBody(mb);
        //rsp.setAlgorithm("");

        return rsp;
    }
    public static DxpMsgResp buildMsgError() {
        DxpMsgResp rsp = new DxpMsgResp();
        DxpHeader header = new DxpHeader();

        rsp.setHeader(header);
        DxpBody mb = new DxpBody();
        mb.setBody("error".getBytes());
        mb.setSbody("send error");
        rsp.setBody(mb);

        return rsp;
    }
        public String toJSONString(){
            return JSON.toJSONString(this, SerializerFeature.PrettyFormat);
        }
}
